package com.bnc.menu;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Insets;

import javax.swing.JPanel;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.EtchedBorder;

import com.bnc.impl.IBNCPanel;
import com.bnc.props.AppProperties;

public abstract class BNCPanel extends JPanel implements IBNCPanel
{
	private JPanel containerPanel;
	private Container contentPanel;
	
	private CompoundBorder borderComp;
	private EmptyBorder borderEmpty;
	private EtchedBorder borderEtch;
	
	private String title; 
	
	public BNCPanel()
	{
		init();
	}
	
	private void init()
	{
		System.out.println("----------- CREATION BNC PANEL -----------");
		int margin = AppProperties.INTERNAL_MARGIN_DEFAULT;
		
		contentPanel = new Container();
		
		borderEmpty = new EmptyBorder( new Insets( margin/2, margin/2, margin/2, margin/2 ) );
		containerPanel = new JPanel();
		containerPanel.setBorder( borderEmpty );
		containerPanel.setLayout( new BorderLayout() );
		containerPanel.add( "Center", contentPanel );
		
		borderEmpty = new EmptyBorder( new Insets( margin, margin, margin, margin ) );
		borderEtch = new EtchedBorder();
		borderComp = new CompoundBorder( borderEmpty, borderEtch );
		
		setBorder( borderComp );
		setLayout( new BorderLayout() );
		add( containerPanel );
	}
	
	public Container getContentPane()
	{
		return contentPanel;
	}
	
	public String getTitle()
	{
		return title;
	}
	
	public void setTitle( String title )
	{
		this.title = title;
	}
}
